home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / pvm34b3.zip / pvm34b3 / pvm3 / include / pvmproto.h < prev    next >
C/C++ Source or Header  |  1997-07-22  |  15KB  |  421 lines

  1.  
  2. /* $Id: pvmproto.h,v 1.13 1997/07/09 13:29:37 pvmsrc Exp $ */
  3.  
  4. /*
  5.  *         PVM version 3.4:  Parallel Virtual Machine System
  6.  *               University of Tennessee, Knoxville TN.
  7.  *           Oak Ridge National Laboratory, Oak Ridge TN.
  8.  *                   Emory University, Atlanta GA.
  9.  *      Authors:  J. J. Dongarra, G. E. Fagg, M. Fischer
  10.  *          G. A. Geist, J. A. Kohl, R. J. Manchek, P. Mucci,
  11.  *         P. M. Papadopoulos, S. L. Scott, and V. S. Sunderam
  12.  *                   (C) 1997 All Rights Reserved
  13.  *
  14.  *                              NOTICE
  15.  *
  16.  * Permission to use, copy, modify, and distribute this software and
  17.  * its documentation for any purpose and without fee is hereby granted
  18.  * provided that the above copyright notice appear in all copies and
  19.  * that both the copyright notice and this permission notice appear in
  20.  * supporting documentation.
  21.  *
  22.  * Neither the Institutions (Emory University, Oak Ridge National
  23.  * Laboratory, and University of Tennessee) nor the Authors make any
  24.  * representations about the suitability of this software for any
  25.  * purpose.  This software is provided ``as is'' without express or
  26.  * implied warranty.
  27.  *
  28.  * PVM version 3 was funded in part by the U.S. Department of Energy,
  29.  * the National Science Foundation and the State of Tennessee.
  30.  */
  31.  
  32. /*
  33.  *    pvmproto.h
  34.  *
  35.  *    PVM protocol definitions.
  36.  *
  37. $Log: pvmproto.h,v $
  38.  * Revision 1.13  1997/07/09  13:29:37  pvmsrc
  39.  * Fixed Author Header.
  40.  *
  41.  * Revision 1.12  1997/06/10  16:38:55  pvmsrc
  42.  * Minor text cleanup.
  43.  *
  44.  * Revision 1.11  1997/05/29  15:15:05  pvmsrc
  45.  * Fixed decl of SM_FIRST:
  46.  *     - some compilers too stupid to know it's an (int)0x80040001...
  47.  *     - D-Oh.
  48.  *
  49.  * Revision 1.10  1997/05/27  14:40:58  pvmsrc
  50.  * Added new TM message:
  51.  *     TM_SHMCONN. This allows socket and shmem task structs to be merged.
  52.  *     Also when exchanged sets new TF flag TF_SHMCONN.
  53.  *
  54.  * Revision 1.9  1997/04/09  14:37:17  pvmsrc
  55.  * PVM patches from the base 3.3.10 to 3.3.11 versions where applicable.
  56.  * Originals by Bob Manchek. Altered by Graham Fagg where required.
  57.  *
  58.  * Revision 1.8  1997/04/08  19:18:11  pvmsrc
  59.  * Damn.  Added matching DM_RESETACK constant...  :-Q
  60.  *
  61.  * Revision 1.7  1997/04/08  19:05:51  pvmsrc
  62.  * Added DM_RESET constant.
  63.  *     - for reset of system, cleanup of persistent message mboxes.
  64.  *
  65.  * Revision 1.6  1997/04/07  18:20:15  pvmsrc
  66.  * Added TMDB_RESET constant.
  67.  *     - for resetting mbox db on pvmreset()...
  68.  *
  69.  * Revision 1.5  1997/04/04  15:45:03  pvmsrc
  70.  * Typos CTXT -> CTX for consistency. Affects task.c, too
  71.  *
  72.  * Revision 1.4  1997/04/03  19:15:52  pvmsrc
  73.  * Added some system defined contexts for use by TM, TC messages
  74.  *
  75.  * Revision 1.3  1997/04/03  16:12:38  pvmsrc
  76.  * Added correct macro for sequence number wrap-around comparison.
  77.  * This is on SEQLESSTHAN and is useful for 16 bit sequence numbers
  78.  *
  79.  * Revision 1.2  1997/01/28  19:14:22  pvmsrc
  80.  * New Copyright Notice & Authors.
  81.  *
  82.  * Revision 1.1  1996/10/25  13:43:38  pvmsrc
  83.  * Initial revision
  84.  *
  85.  *
  86.  */
  87.  
  88. #ifndef    _PVMPROTO_H_
  89.  
  90. #define    _PVMPROTO_H_
  91.  
  92. /* protocol version */
  93.  
  94. #ifndef    SDPROTOCOL
  95. #define    SDPROTOCOL    4302
  96. #endif
  97.  
  98. /*
  99. *    t - task
  100. *    d - pvmd
  101. *    R - resource manager
  102. *    H - hoster
  103. *    T - tasker
  104. */
  105.  
  106. #define    SM_FIRST        (int)0x80040001    /* first SM_ message */
  107. #define    SM_SPAWN        (SM_FIRST+0)    /* t<>R like TM_SPAWN */
  108. #define    SM_EXEC            (SM_FIRST+1)    /* R->d like DM_EXEC */
  109. #define    SM_EXECACK        (SM_FIRST+2)    /* d->R like DM_EXECACK */
  110. #define    SM_TASK            (SM_FIRST+3)    /* t<>R like TM_TASK */
  111. #define    SM_CONFIG        (SM_FIRST+4)    /* t<>R like TM_CONFIG */
  112. #define    SM_ADDHOST        (SM_FIRST+5)    /* t<>R like TM_ADDHOST */
  113. #define    SM_DELHOST        (SM_FIRST+6)    /* t<>R like TM_DELHOST */
  114. #define    SM_ADD            (SM_FIRST+7)    /* R->d like DM_ADD */
  115. #define    SM_ADDACK        (SM_FIRST+8)    /* d->R like DM_ADDACK */
  116. #define    SM_NOTIFY        (SM_FIRST+9)    /* t->R like TM_NOTIFY */
  117. #define    SM_TASKX        (SM_FIRST+10)    /* d->R notify of task exit */
  118. #define    SM_HOSTX        (SM_FIRST+11)    /* d->R notify sched of host delete */
  119. #define    SM_HANDOFF        (SM_FIRST+12)    /* R->d pvmd to new sched */
  120. #define    SM_SCHED        (SM_FIRST+13)    /* t<>R like TM_SCHED */
  121. #define    SM_STHOST        (SM_FIRST+14)    /* d->H start slave pvmds */
  122. #define    SM_STHOSTACK    (SM_FIRST+15)    /* H->d like DM_STARTACK */
  123. #define    SM_STTASK        (SM_FIRST+16)    /* d->T start task */
  124. #define    SM_LAST            (SM_FIRST+16)    /* last SM_ message */
  125.  
  126.  
  127. /*
  128.  *    ddpro.h
  129.  *
  130.  *    Pvmd-pvmd protocol
  131.  *
  132.  * Revision 1.5  1996/05/13  20:24:06  manchek
  133.  * [GEF pvm3.3.10to11 patch updates]
  134.  * added PVMDISTASK
  135.  *
  136.  * Revision 1.4  1995/05/17  16:06:18  manchek
  137.  * cast DM_FIRST to int.
  138.  * added debugging classes
  139.  *
  140.  * Revision 1.3  1994/07/18  19:19:27  manchek
  141.  * added PDMWAITC
  142.  *
  143.  * Revision 1.2  1994/06/03  20:38:13  manchek
  144.  * version 3.3.0
  145.  *
  146.  * Revision 1.1  1993/08/30  23:26:47  manchek
  147.  * Initial revision
  148.  *
  149.  */
  150.  
  151.  
  152. /* protocol version */
  153.  
  154. #ifndef    DDPROTOCOL
  155. #define    DDPROTOCOL    2316
  156. #endif
  157.  
  158. #define    DDMINRETRIES    10
  159. #define    DDMAXRTT        9        /* seconds */
  160. #define    DDMINTIMEOUT    (DDMINRETRIES*DDMAXRTT*2)    /* seconds */
  161. #define    DDERRRETRY        300000    /* uSec */
  162. #define    DDPINGTIME        60        /* (sec) between keepalive pings */
  163. #define    DDBAILTIME        300        /* (sec) for new slave to bail if no config */
  164.  
  165. #define    NEXTSEQNUM(x)        (((x)+1)&0xffff)
  166. #define    SEQNUMCOMPARE(x,y)    ((x)<(y)||(((x)>0x8000)&&((y)<0x8000)))
  167. #define    SEQLESSTHAN(x,y)( ((x)<(y) && (y)-(x) <  32768) ||\
  168.                     ((x)>(y) && (x)-(y) >= 32768) )
  169.  
  170.  
  171. /*DocThis*/
  172. /*
  173.  * Pvmd-pvmd packet header
  174.  *
  175.  *    0               1               2               3
  176.  *   +---------------------------------------------------------------+
  177.  *  0|                              dst                              |
  178.  *   +---------------------------------------------------------------+
  179.  *  4|                              src                              |
  180.  *   +-------------------------------+-------------------------------+
  181.  *  8|             seq               |              ack              |
  182.  *   +---------------+---------------+-------------------------------+
  183.  * 12|     flags     |                                               |
  184.  *   +---------------+-----------------------------------------------+
  185.  */
  186. /*EndDocThis*/
  187.  
  188. #define    DDFRAGHDR        16
  189.  
  190. /* frag flags */
  191.  
  192. #define    FFDAT            4        /* packet contains data, seq num is valid */
  193. #define    FFFIN            8        /* sender closing connection */
  194. #define    FFACK            16        /* ack num is valid */
  195.  
  196. /* d-d message flavors */
  197.  
  198. #define    DM_FIRST        (int)0x80020001    /* first DM_ message */
  199. #define    DM_ADD            (DM_FIRST+0)    /* add hosts to machine */
  200. #define    DM_ADDACK        (DM_FIRST+1)
  201. #define    DM_EXEC            (DM_FIRST+2)    /* start tasks */
  202. #define    DM_EXECACK        (DM_FIRST+3)
  203. #define    DM_SENDSIG        (DM_FIRST+4)    /* signal a task */
  204. #define    DM_HTUPD        (DM_FIRST+5)    /* define new host table */
  205. #define    DM_HTUPDACK        (DM_FIRST+6)
  206. #define    DM_HTCOMMIT        (DM_FIRST+7)    /* switch to new host table */
  207. #define    DM_SLCONF        (DM_FIRST+8)    /* config slave pvmd */
  208. #define    DM_STARTACK        (DM_FIRST+9)    /* pvmd' completed slave startup */
  209. #define    DM_TASK            (DM_FIRST+10)    /* get list of tasks */
  210. #define    DM_TASKACK        (DM_FIRST+11)
  211. #define    DM_DELHOST        (DM_FIRST+12)    /* delete hosts from machine */
  212. #define    DM_DELHOSTACK    (DM_FIRST+13)
  213. #define    DM_NULL            (DM_FIRST+14)    /* null message */
  214. #define    DM_TASKOUT        (DM_FIRST+15)    /* task standard out/err data */
  215. #define    DM_PSTAT        (DM_FIRST+16)    /* query status of task */
  216. #define    DM_PSTATACK        (DM_FIRST+17)
  217. #define    DM_HALT            (DM_FIRST+18)    /* request master pvmd to halt */
  218. #define    DM_MCA            (DM_FIRST+19)    /* define multicast tid */
  219. #define    DM_NOTIFY        (DM_FIRST+20)    /* request notify */
  220. #define    DM_NOTIFYACK    (DM_FIRST+21)
  221. #define    DM_DB            (DM_FIRST+22)    /* message-mailbox request */
  222. #define    DM_DBACK        (DM_FIRST+23)
  223. #define    DM_RESET        (DM_FIRST+24)    /* reset linkage (mbox tidy) */
  224. #define    DM_RESETACK        (DM_FIRST+25)
  225. #define    DM_HTDEL        (DM_FIRST+26)    /* delete hosts from host table */
  226. #define    DM_HOSTSYNC        (DM_FIRST+27)    /* request clock sample */
  227. #define    DM_HOSTSYNCACK    (DM_FIRST+28)
  228. #define    DM_LAST            (DM_FIRST+28)    /* last DM_ message */
  229.  
  230. /* DM_SLCONF fields - don't use 0 */
  231.  
  232. #define    DM_SLCONF_EP    1        /* set epath */
  233. #define    DM_SLCONF_BP    2        /* set bpath */
  234. #define    DM_SLCONF_WD    3        /* set wdir */
  235. #define    DM_SLCONF_SCHED    4        /* set scheduler tid */
  236. #define    DM_SLCONF_TRACE    5        /* set tracer info */
  237.  
  238. /* pvmd run states */
  239.  
  240. #define    PVMDNORMAL        1        /* normal running state */
  241. #define    PVMDHTUPD        2        /* getting host table update */
  242. #define    PVMDSTARTUP        3        /* slave just started, not fully configured */
  243. #define    PVMDPRIME        4        /* am pvmd' */
  244. #define    PVMDHALTING        5        /* stopping rsn */
  245. #define    PVMDSHUTDOWN    6        /* in timeout to halt, waiting for FIN|ACK */
  246. #define    PVMDISTASK        7        /* between fork and exec to spawn task */
  247.  
  248. /* used to cache multicast addresses */
  249.  
  250. struct mca {
  251.     struct mca *mc_link;    /* dll of peers */
  252.     struct mca *mc_rlink;
  253.     int mc_tid;                /* the multicast tid */
  254.     int mc_ndst;            /* number of dsts */
  255.     int *mc_dsts;            /* dst tids (local tasks or foreign pvmds) */
  256. };
  257.  
  258. struct mca *mca_new __ProtoGlarp__(( void ));
  259. void mca_free __ProtoGlarp__((struct mca *mcap));
  260. struct pmsg *mesg_new __ProtoGlarp__(( int master ));
  261.  
  262.  
  263. /*
  264.  *    tdpro.h
  265.  *
  266.  *    Task-pvmd protocol
  267.  *
  268.  * Revision 1.5  1995/06/28  15:32:29  manchek
  269.  * added TC_SHMAT
  270.  *
  271.  * Revision 1.4  1995/05/17  16:56:06  manchek
  272.  * added support for CSPP subcomplexes (/tmp file naming).
  273.  * case TM_FIRST, TC_FIRST to int
  274.  * add TM_GETOPT message
  275.  *
  276.  * Revision 1.3  1994/06/03  20:38:31  manchek
  277.  * version 3.3.0
  278.  *
  279.  * Revision 1.2  1993/10/04  20:30:50  manchek
  280.  * added alternate TDSOCKNAME if SHAREDTMP is defined
  281.  *
  282.  * Revision 1.1  1993/08/30  23:26:52  manchek
  283.  * Initial revision
  284.  *
  285.  */
  286.  
  287.  
  288. /* protocol version */
  289.  
  290. #ifndef    TDPROTOCOL
  291. #define    TDPROTOCOL    1318
  292. #endif
  293.  
  294. /*DocThis*/
  295. /*
  296.  * Task-task, task-pvmd fragment header
  297.  *
  298.  *    0               1               2               3
  299.  *   +---------------------------------------------------------------+
  300.  *  0|                              dst                              |
  301.  *   +---------------------------------------------------------------+
  302.  *  4|                              src                              |
  303.  *   +---------------------------------------------------------------+
  304.  *  8|                             length                            |
  305.  *   +---------------+-----------------------------------------------+
  306.  * 12|     flags     |                                               |
  307.  *   +---------------+-----------------------------------------------+
  308.  */
  309. /*EndDocThis*/
  310.  
  311. #define    TDFRAGHDR    16
  312.  
  313. /*
  314. * Maximum size of all headers in system
  315. */
  316.  
  317. #define    MAXHDR        ((DDFRAGHDR > TDFRAGHDR ? DDFRAGHDR : TDFRAGHDR) \
  318.                     + MSGHDRLEN)
  319.  
  320. /* file with task->pvmd sockaddr */
  321.  
  322. #ifdef    SHAREDTMP
  323. #define    TDSOCKNAME    "/tmp/pvmd.%d.%s"
  324. #else
  325. #define    TDSOCKNAME    "/tmp/pvmd.%d"
  326. #endif
  327.  
  328. #ifdef    IMA_CSPP
  329. #ifdef    SHAREDTMP
  330. #define    TDSOCKNAME_CSPP    "/tmp/pvmd.%d.%d.%s"
  331. #else
  332. #define    TDSOCKNAME_CSPP    "/tmp/pvmd.%d.%d"
  333. #endif
  334. #endif    /*IMA_CSPP*/
  335.  
  336. #define    TM_FIRST    (int)0x80010001    /* first TM_ message */
  337. #define    TM_CONNECT    (TM_FIRST+0)    /* task connects */
  338. #define    TM_CONN2    (TM_FIRST+1)    /* 2nd round of connect */
  339. #define    TM_EXIT        (TM_FIRST+2)    /* task disconnects */
  340. #define    TM_ADDHOST    (TM_FIRST+3)    /* add hosts to machine */
  341. #define    TM_DELHOST    (TM_FIRST+4)    /* delete hosts from machine */
  342. #define    TM_CONFIG    (TM_FIRST+5)    /* get machine config */
  343. #define    TM_MSTAT    (TM_FIRST+6)    /* get host status */
  344. #define    TM_HALT        (TM_FIRST+7)    /* halt machine */
  345. #define    TM_TICKLE    (TM_FIRST+8)    /* tickle pvmd */
  346. #define    TM_SPAWN    (TM_FIRST+9)    /* spawn new tasks */
  347. #define    TM_PSTAT    (TM_FIRST+10)    /* get task status */
  348. #define    TM_SENDSIG    (TM_FIRST+11)    /* signal a task */
  349. #define    TM_TASK        (TM_FIRST+12)    /* list tasks */
  350. #define    TM_MCA        (TM_FIRST+13)    /* request multicast tid */
  351. #define    TM_NOTIFY    (TM_FIRST+14)    /* request notification */
  352. #define    TM_DB        (TM_FIRST+15)    /* message-mailbox request */
  353. #define    TM_SCHED    (TM_FIRST+16)    /* register task as scheduler */
  354. #define    TM_TASKER    (TM_FIRST+17)    /* register task as task starter */
  355. #define    TM_HOSTER    (TM_FIRST+18)    /* register task as pvmd starter */
  356. #define    TM_TRACER    (TM_FIRST+19)    /* register task as task tracer */
  357. #define    TM_HOSTSYNC    (TM_FIRST+20)    /* get clock delta to host */
  358. #define    TM_SETOPT    (TM_FIRST+21)    /* set task parameters */
  359. #define    TM_GETOPT    (TM_FIRST+22)    /* get all task parameters */
  360. #define    TM_CONTEXT    (TM_FIRST+23)    /* allocate or free a context id */
  361. #define    TM_SHMCONN    (TM_FIRST+24)    /* shmem task connect */
  362. #define    TM_LAST        (TM_FIRST+25)    /* last TM_ message */
  363.  
  364. /*
  365. * for TM_DB
  366. */
  367.  
  368. #define    TMDB_PUT    1            /* insert message */
  369. #define    TMDB_REMOVE    2            /* delete entry */
  370. #define    TMDB_GET    3            /* retrieve entry */
  371. #define    TMDB_NAMES    4            /* get list of all names defined */
  372. #define    TMDB_RESET    5            /* wipe out mbox db entries */
  373.  
  374. /*
  375. * for TM_SETOPT
  376. */
  377.  
  378. #define    TS_OUTTID    1                /* stdout dst */
  379. #define    TS_OUTCTX    2                /* stdout message context */
  380. #define    TS_OUTTAG    3                /* stdout message tag */
  381. #define    TS_TRCTID    4                /* trace dst */
  382. #define    TS_TRCCTX    5                /* trace message context */
  383. #define    TS_TRCTAG    6                /* trace message tag */
  384.  
  385. #define    TC_FIRST        (int)0x80030001    /* first TC_ message */
  386. #define    TC_CONREQ        (TC_FIRST+0)    /* connection request */
  387. #define    TC_CONACK        (TC_FIRST+1)    /* connection request ack */
  388. #define    TC_TASKEXIT        (TC_FIRST+2)    /* task exited/doesn't exist */
  389. #define    TC_NOOP            (TC_FIRST+3)    /* do nothing */
  390. #define    TC_OUTPUT        (TC_FIRST+4)    /* child stdout data */
  391. #define    TC_SETTRACE        (TC_FIRST+5)    /* set task tracing */
  392. #define    TC_SETTMASK        (TC_FIRST+6)    /* set task trace mask */
  393. #define    TC_SETTRCBUF    (TC_FIRST+7)    /* set task trace buffer */
  394. #define    TC_SETTRCOPT    (TC_FIRST+8)    /* set task trace options */
  395. #define    TC_SHMAT        (TC_FIRST+9)    /* shmem connect handshake */
  396. #define    TC_OUTPUTX        (TC_FIRST+10)    /* (not sent) flush out coll */
  397. #define    TC_SIBLINGS        (TC_FIRST+11)    /* parent announce spawn grp */
  398. #define    TC_LAST            (TC_FIRST+11)    /* last TC_ message */
  399.  
  400.  
  401. /* Contexts Used by Some System Calls - these are allocated from the
  402.    top of the context space */
  403.  
  404. #define SYSCTX_FIRST    (int) 0x0007ffff    /* first system context */
  405. #define SYSCTX_TC        (SYSCTX_FIRST-0)    /* ctxt for TC messages */
  406. #define SYSCTX_TM        (SYSCTX_FIRST-1)    /* ctxt for TM messages */
  407. #define SYSCTX_SG        (SYSCTX_FIRST-2)     /* ctxt for static group formation*/
  408. #define SYSCTX_RS4        (SYSCTX_FIRST-4)    /* Reserved system context */
  409. #define SYSCTX_RS5        (SYSCTX_FIRST-5)    /* Reserved system context */
  410. #define SYSCTX_RS6        (SYSCTX_FIRST-6)    /* Reserved system context */
  411. #define SYSCTX_RS7        (SYSCTX_FIRST-7)    /* Reserved system context */
  412. #define SYSCTX_RS8        (SYSCTX_FIRST-8)    /* Reserved system context */
  413. #define SYSCTX_RS9        (SYSCTX_FIRST-9)    /* Reserved system context */
  414. #define SYSCTX_LAST        (SYSCTX_FIRST-9)
  415. #define NUM_SYSCTX        (SYSCTX_FIRST-SYSCTX_LAST+1)            
  416.  
  417. #define BASECONTEXT        (int) 0
  418.  
  419. #endif    /*_PVMPROTO_H_*/
  420.  
  421.